<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * Hash handling
 *
 * PHP version 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category    Encription
 * @package     Hash
 * @author      Kazuyoshi Tlacaelel <kazu.php@gmail.com> 
 * @copyright   2007 Kazuyoshi Tlacaelel
 * @license     http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version     SVN : $Id
 */

/**
 * Hash 
 * 
 * @category    Encription
 * @package     Hash
 * @version     $id$
 * @author      Kazuyoshi Tlacaelel <ktlacaelel@gmail.com> 
 * @license     PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
 */
class Hash
{
    protected 

    /**
     * prefix 
     * 
     * @static
     * @var     string
     * @access  public
     */
    static $prefix = 'id_';

    /**
     * prefix changer
     *
     * renames the default value of prefix
     * 
     * @param   string      $prefix 
     * @access  public
     * @return  void
     */
    public function setPrefix($prefix)
    {
        self::$prefix = $prefix;
    }

    /**
     * hash generator
     * 
     * creates a hash prefixed with $prefix
     * 
     * @param   string      $prefix 
     * @static
     * @access  public
     * @return  void
     */
    public static function generate($prefix = false)
    {
        if (!$prefix) {
            $prefix = self::$prefix;
        }
        return uniqid($prefix);
    }
}

?>
